#!/bin/sh

#Add java8 account
adduser --disabled-password --gecos "" java8
su java8 -c "cd /home/java8;
wget http://172.24.94.212/jdk-8u241-linux-x64.tar.gz;
tar xfz jdk-8u241-linux-x64.tar.gz"

touch /etc/environment
truncate -s 0 /etc/environment
cat >> /etc/environment << EOF
JAVA_HOME=/home/java8/jdk1.8.0_241
PATH="/home/java8/jdk1.8.0_241/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
EOF

#disable apparmor here because it's also necessary reboot
systemctl disable apparmor
reboot
